package org.xp.judgeplatform.pojo.entity;


import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("login_devices")
@Schema(description = "登录设备记录实体")
public class LoginDevices {

    @TableId(type = IdType.AUTO)
    @Schema(description = "设备记录ID", example = "1")
    private Long id;

    @TableField("user_id")
    @Schema(description = "用户ID", example = "1")
    private Integer userId;

    @TableField("device_id")
    @Schema(description = "设备唯一标识", example = "abc123def456")
    private String deviceId;

    @TableField("device_name")
    @Schema(description = "设备名称", example = "Windows (本机)")
    private String deviceName;

    @TableField("device_type")
    @Schema(description = "设备类型", example = "PC")
    private String deviceType;

    @TableField("browser")
    @Schema(description = "浏览器信息", example = "Edge 120.0.0.0")
    private String browser;

    @TableField("os")
    @Schema(description = "操作系统", example = "Windows 11")
    private String os;

    @TableField("login_method")
    @Schema(description = "登录方式", example = "网页登录")
    private String loginMethod;

    @TableField("ip_address")
    @Schema(description = "IP地址", example = "192.168.1.1")
    private String ipAddress;

    @TableField("location")
    @Schema(description = "登录地点", example = "福建省 泉州市")
    private String location;

    @TableField("is_active")
    @Schema(description = "是否活跃会话", example = "true")
    private Boolean isActive;

    @TableField("session_token")
    @Schema(description = "会话令牌", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...")
    private String sessionToken;

    @TableField(value = "last_login_time", insertStrategy = FieldStrategy.NEVER)
    @Schema(description = "最后登录时间")
    private LocalDateTime lastLoginTime;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;
}
